package com.aizhixin.quick.controller;


import com.aizhixin.quick.mapper.ExamMapper;
import com.aizhixin.quick.service.ExamService;
import com.aizhixin.quick.utils.Result;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2021-08-09
 */
@RestController
@Api(tags = "试题基础操作")
@RequestMapping("/exam")
public class ExamController {

    @Autowired
    ExamService examService;
    @Autowired
    ExamMapper examMapper;

 /*
查询所有考题
  */
    @PostMapping("/listAllExam")
    public Result listAllExam(){
         examService.list();
        return Result.ok();
    }

 /*
新增考试题
 */
    @PostMapping("/saveExam")
    public Result saveExam(){
        examService.save();
    return Result.ok();
}

/*
  根据考题标题查询
 */
    @GetMapping("/selectByName")
    public Result selectByName(){
       examMapper.selectList();
       return Result.ok();
   }

/*
根据考题分类查询
 */
    @GetMapping("/selectByType")
    public Result selectByType(){
        examMapper.selectList();
        return Result.ok();
    }


/*
根据试题等级查找
 */
@GetMapping("/selectByLevel")
    public Result selectByLevel(){
    examMapper.selectList();
    return Result.ok();
}

/*
根据id 修改试题信息
 */
    @PutMapping("/updateExam")
    public Result updateExam(){
        examService.updateById();
        return Result.ok();
    }

/*
根据id 删除试题
 */
    @DeleteMapping("/deleteExamByid")
    public Result deleteExamByid(){
        examService.removeById();
        return Result.ok();
    }

}

